from flask import Flask, render_template, jsonify, make_response, url_for, redirect

app = Flask(__name__)


@app.route('/')
def hello_world():  # put application's code here
    user1 = {'name' :'john', 'age' : 20}
    user2 = {'name' :'jane', 'age' : 30}
    list_users = [user1, user2]
    res = make_response(jsonify(list_users),202)
    return res

@app.route('/hello')
def hello():  # put application's code here
    user1 = {'name' :'john', 'age' : 20}
    user2 = {'name' :'jane', 'age' : 30}
    user3 = {'name': 'jane', 'age': 30}
    list_users = [user1, user2,user3]
    res = make_response(jsonify(list_users),202)
    return res
@app.route('/main/<num>')
def main(num):  # put application's code here
    return render_template('index.html',num = num)


@app.route('/hello/flask')
def greet():
    # return f"{url_for('greet')}"   # 反向解析视图函数greet()对应的URL
      return   redirect(url_for("hello"))







if __name__ == '__main__':
    app.run()

